1. Field of the Invention
The invention relates to a method for automatically focusing in a photographic module and the electronic device thereof and, more particularly, to a method for automatically focusing in a photographic module which can focus rapid and accurate and the electronic device using the same.
2. Description of the Related Art
With the progress of the science and technology, a single electronic device with a single function gradually becomes a single electronic device with multiple functions to meet the consumer's demand for convenience.
As for the multi-functionality of a mobile phone, the conventional mobile phone can not only provide the communication function, but also provide functions such as playing games, accessing the Internet, reading electronic books and photographing and so on, wherein the photographing function which can capture instant image is very loved by people. The photographing function of a mobile phone is mainly provided by a photographic module installed in the mobile phone. Generally speaking, the method for automatically focusing in a photographic module is performed as follows. High frequency components are analyzed to calculate an automatic focus (AF) evaluation value first, and then the lens is moved to focus until a greatest AF evaluation value is obtained, and then, the AF is finished.
Specifically, the conventional the method for automatically focusing in a photographic module is performed as follows. In the whole focus range of the photographic module, every time the lens moves a preset distance, the AF evaluation value obtained after the lens moves the preset distance is calculated, and the above steps are repeated until the lens moves to the other end of the focus range. At last, the lens moves back to the position where the photographic module has greatest AF evaluation value.
However, the number of sampling times needed in the method is in inverse proportion to the moving distance of the lens every time. That is, the less the moving distance of the lens is, the more the number of sampling times is, and the higher the accuracy of focus is, but the lens needs a longer focus time. On the contrary, if the focus time of the lens is decreased, the number of the sampling times of focus is certainly decreased, and the moving distance of the lens is greater, which causes that the optimum focus position of the lens cannot be sampled.